package com.okok.dao.impl;


/*
 *  
 * 
 * @author sky
 * @date 2018/9/12 15:37
 * @param 
 * @return 
 */
/*@Service("UserDaoImp")
@Repository

public class UserDaoImp implements UserDao {

    @Autowired
    private MongoTemplate mongoTemplate;
*/

    /*
     *
     * 登录的实现
     * @author sky
     * @date 2018/9/12 9:30
     * @param [loginName]
     * @return com.okok.dto.UserDTO
     */
/*
    @Override
    public UserDTO login(String loginName){
        //根据username查询
      Query sql = new Query(Criteria.where("username").is(loginName));
       return   mongoTemplate.findOne(sql, UserDTO.class);
    }
*/

    /*
     *
     * 注册的实现
     * @author sky
     * @date 2018/9/12 9:30
     * @param [UserDTO]
     * @return void
     */
/*
    @Override
    public void register(UserDTO userDTO){
        mongoTemplate.save(userDTO);
    }

    @Override
    public long updataPWD(UserDTO userDTO){
        Query query = new Query();
        //查询多条件写法
        Criteria criteria=Criteria.where("username").is(userDTO.getLoginname());
        criteria.and("password").is(userDTO.getPwd());
        query.addCriteria(criteria);

        Update update = new Update();
        //更新多个字段
        update.set("username", "7");
        update.set("password", "7");

        //参数解释(查询要修改的条目，要修改哪些东西,mongo集合名)
      //  mongoTemplate.updateFirst(query, update,"userDTO");
        //在UserDTO.class中指定过集合名为user所以此处可直接用下面的语句,getModifiedCount为修改的行数
          return mongoTemplate.updateFirst(query, update,  UserDTO.class).getModifiedCount();
    }
*/

//}
